@using BTCPayServer.Configuration;
@using Microsoft.AspNetCore.Mvc.ViewFeatures;
@inject IFileVersionProvider FileVersionProvider
@inject BTCPayServerOptions BTCPayServerOptions

<svg role="img" class="icon icon-@Symbol @(string.IsNullOrWhiteSpace(Class) ? "" : Class)">
	<use href="@GetPathTo(Symbol)"></use>
</svg>
@code {
    [Parameter, EditorRequired]
    public string Symbol { get; set; }

    [Parameter]
    public string Class { get; set; }
    private string GetPathTo(string symbol)
	{
		var versioned = FileVersionProvider.AddFileVersionToPath(default, "img/icon-sprite.svg");
        var rootPath = (BTCPayServerOptions.RootPath ?? "/").WithTrailingSlash();
		return $"{rootPath}{versioned}#{symbol}";
	}
}
